package emulator.support;

import emulator.hardware.HwByte;
import emulator.util.MemoryPtr;

public class ZeroPageYOperandEval implements OperandEval {

	MemoryPtr instruction;

	public ZeroPageYOperandEval(MemoryPtr ptr) {
		instruction = ptr;
	}

	@Override
	public String getDetails(CpuState cpu_state) {
		int reg_y = cpu_state.getValue("Y");
		int operand = instruction.getByteOp();
		instruction.setAddress((operand+reg_y) & 0xff);
		return "($" + new HwByte(operand) + " + $" + new HwByte(reg_y) + ") -> $" + new HwByte(instruction.getByteOp());
	}

}
